/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package relenriadweb.devel;

import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;

/**
 *
 * @author ppikarin
 */
public class TestHelper {
    
    Session session = null;

    public TestHelper() {
        this.session = HibernateUtil.getSessionFactory().getCurrentSession();
    }
    
    public List getTestTitles(int startID, int endID) {
    List<Test> filmList = null;
    try {
        org.hibernate.Transaction tx = session.beginTransaction();
        Query q = session.createQuery ("from Test as test where test.id between '"+startID+"' and '"+endID+"'");
        filmList = (List<Test>) q.list();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return filmList;
    }
    
    
    public List getTextByID(int testId) {
        List<Test> filmList = null;
        try {
            org.hibernate.Transaction tx = session.beginTransaction();
            Query q = session.createQuery ("from Test as test where test.id='"+testId+"'");
            filmList = (List<Test>) q.list();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return filmList;
    }

    List getTestText(int testId) {
          
    
}
